<?php if (!defined('THINK_PATH')) exit();?><style type="text/css">
	.update_tb tr{
		height:30px;
	}
	.label{
		padding:0 5px 0 10px;
	}
	.labels{
		font-size: 12px;
    font-weight: bold;
    color: #0E2D5F;
    height: 16px;
	}
	/* 上传btn修改样式 */
.uploadify-button {
    border: 1px solid #F3EEEE;
    background-color:rgba(102, 174, 236, 0.91);
    line-height: 30px;
    border-radius: 4px;
    font-size: 15px;
}

.uploadify-button:hover {
    background-color:#EF5959; 
}
.rowStyle{
	background-color: red;
}
.validatebox-readonly{
	/*background-color: rgba(208, 206, 206, 0.37);*/
}
#zpyl label{
	display:inline-block; 
	width:70px;
	padding:5px 0 5px 10px;
}
#zpyl div{

	padding:5px 0 5px 0px;
}
/*附件样式*/
.gzfile{
	width:100px;
}
.gzfile span{
	background-color:#fc0;
display:-moz-inline-box;
display:inline-block;
width:60px;
text-align: center;
}
</style>

<div id="cc1" class="easyui-layout" data-options="fit:true,border:false">    
 

       

    <div data-options="region:'center',title:'',border:false" style="padding:5px;background:#eee;">
    	
    	<table id="gz-dg"></table>
    </div>  
    <div id="show_url" data-options="region:'south',iconCls:'icon-standard-report',title:'管子列表附件',split:true,hideCollapsedContent:false" style="height:260px;">
    <table id="gz-dg-fj"></table>
    </div> 
</div>  


<!--工具栏 -->
<style>

	.finaSeDiv{
		float:left;
		padding:10px 0 5px 10px;
		width:200px;
	}
	.finaSeDiv label{
		width:53px;
		float: left;
	}
	.table-btn-separator {
    float: center;
    border-top: 1px solid #ccc;
    border-bottom: 1px solid #fff;
  /*  width: 1200px;*/
}


    .uploadpic{
        float:left;
        width: 295px;
        text-align:center;
        height:165px;
    }
    .uploadpic h3{
        text-align:left;
        border:1px solid  #95B8E7;
        float:left;
        padding:4px;
        background-color:#95B8E7;
        color:#FFF;
    }
    .up-content{
        border:1px solid  #95B8E7;
        padding:4px;
    }
    .w10{
        float:left;
        width:10px;
        color:#FFF;
    }
    .items{
        padding:10px 0 4px 0;
        border-top: solid 1px #D6D4D4;
        display: block;
    }
    #dd div{
        padding-right: 10px;
        padding-bottom: 10px;
    }
    .addItems{
        float: left;
    }


    .add_table{
        width:100%;
    }
    .add_table th{
        width:140px;
        background-color: #E0ECFF;
        padding: 8px 0 8px 0;
        border-right:solid 1px #95B8E7;
        border-bottom: solid 1px #95B8E7;
    }
    .add_table td{
        border-bottom: solid 1px #95B8E7;
    }
    .add_table tr{
        border:solid 1px #95B8E7;
    }
    .tb_head{
        text-align: center;
        padding: 10px;
        background-color: #E0ECFF;
        font-size: 20px;
        font-weight: bold;
    }
    .inline{
        display:inline
    }
    .row_container{
        padding:8px 5px 5px 5px;
    }
    .add_label{
width:82px;
display:-moz-inline-box; /* css注释：for ff2 */ 
display:inline-block; 
    }


    .uploadify-button {
      background-color: #A0D468;
    background-image: none;
    color: #FFF;
    font-size: 14px;
    padding: 2px 15px;

    border: none;
}
.uploadify-button:hover{
color:#FFF;
background-color: #f0ad4e;
background-image: none;
}
.uploadify-queue{
    width:50%;
}
.uploadify-progress{
    width:95%;
}
.textbox textarea.textbox-text {
white-space: pre-wrap;
}

</style>

<div id="tool-gz">    

<table>
	<tr>
		
			

				<td>
		
	        <a href="#" id= "aaa1" class="easyui-linkbutton"  onclick='show_add_gzlist()' data-options="iconCls:'icon-standard-folder-page',plain:true">添加</a>
	

	        <a href="#" class="easyui-linkbutton"  onclick='dele_gz()' data-options="iconCls:'icon-standard-page-white-delete',plain:true">删除</a> 
	  
	        <a href="#" class="easyui-linkbutton"  onclick='show_gzedit()' data-options="iconCls:'icon-standard-application-edit',plain:true">编辑</a> 
	   
	</td>

		<td>
	    	<div class="datagrid-btn-separator"></div>
		</td>    

	<td>
		
	        <a href="#"  class="easyui-linkbutton"   onclick="excel()" data-options="iconCls:'icon-standard-page-white-excel',plain:true">导出</a>

		 	</td>

			<td>
     			<div class="datagrid-btn-separator"></div>
 			</td>
				  
	
		<td>
			分类：
			<select id="gz_fl" class="easyui-combobox" name="fl" style="width:80px;" data-options="editable:false,panelHeight:'auto'">   
			    <option value="" selected="selected"> .</option>   
			    <option value="军车">军车</option>   
			    <option value="民车">民车</option>   
			    <option value="其他">其他</option>   
			</select> 
		</td>
		<td>
		    <div class="datagrid-btn-separator"></div>
		</td>
		<td>
		    标题：<input id="gz_title" name="title" class="easyui-textbox" data-options="" style="width:120px"> 
		</td>
		<td id="jun_gz">
			车型：<input id="gz_cx" name="cx" class="easyui-textbox" data-options="" style="width:120px"> 
		</td>

		<td id="min_gz">
			驾驶室：

					<input id="gz_pt" class="easyui-combobox" name="pt"   
    data-options="valueField:'text',textField:'textshow',url:'/solve/index.php/Home/Gz/ptlist',editable:false,panelHeight:'auto'" style="width:100px;"/>

    		车类：
			<select id="gz_cl" class="easyui-combobox" name="cxfl" style="width:50px;" data-options="editable:false,panelHeight:'auto'">   
			    <option value="" selected="selected"> .</option>   
			    <option value="1">1</option>   
			    <option value="2">2</option>   
			    <option value="3">3</option>
			    <option value="4">4</option>
			    <option value="5">5</option>   
			</select>  
			
		</td>
		<td>
			<a href="#" class="easyui-linkbutton"  onclick="search_gzlist()" data-options="iconCls:'icon-search',plain:'true'">搜索</a>
		</td>





		<!-- <td>
		装配计划号：<input id="jhh" name="jhh" class="easyui-textbox" data-options="" style="width:110px"> 
		流水号：<input id="lsh" name="lsh" class="easyui-textbox" data-options="prompt:'请输入单个流水号…'" style="width:110px"> 
		车型配置<input id="cjpz" name="cjpz" class="easyui-textbox" data-options="prompt:''" style="width:110px"> 
			  <a href="#" class="easyui-linkbutton"  onclick="search_mes()" data-options="iconCls:'icon-search',plain:'true'">搜索</a> 
		</td>
		<td>
		    <div class="datagrid-btn-separator"></div>
		</td>
   <td>

	  <a href="#" class="easyui-linkbutton"  onclick="reloadmes()" data-options="iconCls:'icon-standard-arrow-refresh',plain:true">刷新</a> 

   </td>
   		 <td>
     <div class="datagrid-btn-separator"></div>
 </td> -->



</tr>

</table>





</div>
<!-- 管子附件工具栏 -->
<div id="tool-gz-fj">    

<table>
	<tr>
	
			

				<td>
		<?php if(authCheck1('Home/Quality/add_quality')): ?><a href="#" id= "aaa1" class="easyui-linkbutton"  onclick='show_add_gzfj()' data-options="iconCls:'icon-standard-folder-page',plain:true">添加</a><?php endif; ?>
	    <?php if(authCheck1('Home/Quality/del')): ?><a href="#" class="easyui-linkbutton"  onclick='dele_gz_fj()' data-options="iconCls:'icon-standard-page-white-delete',plain:true">删除</a><?php endif; ?>
	    <?php if(authCheck1('Home/Quality/edit')): ?><a href="#" class="easyui-linkbutton"  onclick='delall_gz_fj()' data-options="iconCls:'icon-standard-application-edit',plain:true">删除所有</a><?php endif; ?>
	</td>
	
</tr>

</table>





</div>
<script type="text/javascript">
/*军车民车其他搜索*/
	$('#gz_fl').combobox({
	onChange: function(newValue,oldValue){
		// console.log(newValue+"+"+oldValue);
		$('#gz-dg').datagrid('load',{
		fl:newValue
		
	});

		//影藏显示
		if(newValue=='军车'){
			$("#jun_gz").show();
			$("#min_gz").hide(); 

		}
		if(newValue=='民车'){
			$("#jun_gz").hide();
			$("#min_gz").show(); 

		}
		if(newValue=='' || newValue=='其他'){
			$("#jun_gz").show();
			$("#min_gz").show(); 

		}
		
	}
	,
	onLoadSuccess:function(){
		$("#jun_gz").show();
			$("#min_gz").show(); 
	}
});

	// 显示添加管子列表
function show_add_gzlist(){
	// $("#addok").linkbutton("enable");
		var myDate = new Date();
		$('#add_gzlist_form').form('load', {
					fl : '',
					cx:'',
					title:'',
					pt : '',
					cxfl:''
				});
		$('#add_gz_file').filebox('clear');
		$('#add_gzlist').window('open'); // open a window 
		// $('#date').datetimebox('setValue', formatterDate(new Date()));	
}

function show_add_gzfj(){
	var row = $('#gz-dg').datagrid("getSelected");
	if (row) {
		$('#gz_add_fj').window('open'); // open a window 
			} else {

			$.messager.alert("无法添加", "请选择要添加附件的管子列表！", "info");
		}
}

function search_gzlist(){
	$('#gz-dg').datagrid('load',{

			 title:$('#gz_title').textbox('getText'),
			 cx:$('#gz_cx').textbox('getText'),
			pt:$('#gz_pt').combobox('getValue'),
			cxfl:$('#gz_cl').combobox('getValue')

			 });
}

</script>



<!-- 管子列表添加页面 -->
<div id="add_gzlist" class="easyui-dialog" style="width:870px; height: 368px; padding: 0px; overflow: hidden;" title="添加管子列表" data-options="iconCls:'icon-standard-folder-page',buttons:'#dlg-addgzlist',closed:true,resizable:false,modal:true,closable:true">
    <form id="add_gzlist_form"  enctype="multipart/form-data" method="post" >
        <table class="add_table">
            <tr>
                <th>分类</th>
                <td>
                    <div class="row_container" style="background: #FFFEE6;">
                        <div class="inline">

                            <select id="gz_fl_add" class="easyui-combobox" name="fl" style="width:80px;" data-options="editable:false,panelHeight:'auto'">   
                <option value="" selected="selected"> .</option>   
                <option value="军车">军车</option>   
                <option value="民车">民车</option>   
                <option value="其他">其他</option>   
            </select> 


                        </div>

                    </div>
                </td>
            </tr>
             <tr>
                <th>标题</th>
                <td style="background-color:rgba(204, 204, 204, 0.4);">
                    <div class="row_container">
                        <div class="inline">
                            <input id="add_gz_title" name="title" class="easyui-textbox" data-options="iconCls:'',editable:true,required:true"   style="width:650px" />
                        </div>
                       

                    </div>

                </td>
            </tr>
            <tr>
                <th>车型(军车)</th>
                <td style="background-color:rgba(204, 204, 204, 0.4);">
                    <div class="row_container">
                        <div class="inline">
                            <input id="cx_gz" name="cx" class="easyui-textbox" data-options="iconCls:'',editable:true,required:false"   style="width:300px" />
                        </div>
                       

                    </div>

                </td>
            </tr>
             <tr>
                <th>驾驶室</th>
                <td style="background-color:rgba(204, 204, 204, 0.4);">
                    <div class="row_container">
                        <div class="inline">
                            <input id="gz_add_pt" class="easyui-combobox" name="pt"   
    data-options="valueField:'text',textField:'text',url:'/solve/index.php/Home/Gz/ptlist',editable:false,panelHeight:'auto'" style="width:100px;"/> 
                        </div>
                       

                    </div>

                </td>
            </tr>
             <tr>
                <th>车类</th>
                <td style="background-color:rgba(204, 204, 204, 0.4);">
                    <div class="row_container">
                        <div class="inline">
                            <select id="add_gz_cl" class="easyui-combobox" name="cxfl" style="width:50px;" data-options="editable:false,panelHeight:'auto'">   
                <option value="" selected="selected"> .</option>   
                <option value="1">1</option>   
                <option value="2">2</option>   
                <option value="3">3</option>
                <option value="4">4</option>
                <option value="5">5</option>   
            </select>  
            <span class="tip">1:载货车，2：越野车，3：自卸车，4：牵引车，5：专用车</span>
                        </div>
                       

                    </div>

                </td>
            </tr>
            <tr>
                <th>上传文件</th>
                <td>
                    <div class="row_container" style="background: #FFFEE6;">
                        <div class="inline" id="gzlist_uploadfile">

                            <input   name="url[]" id="add_gz_file" style="width:650px;"  class="easyui-filebox" data-options="buttonText:'上传文件',buttonIcon:'icon-standard-application-edit',accept:'application/*,image/*',multiple:'true'">


                        </div>

                    </div>
                </td>
            </tr>
            
            <tr>
                <th>备注</th>
                <td>
                    <div class="row_container">

                        <textarea  name="bz" class="easyui-textbox" id="content" style="width: 100%; height: 50px;"  data-options="required:false,multiline:true,prompt:''"></textarea>



                    </div>
                </td>
            </tr>

        </table>

        <input type="hidden" name="userid" id="userid" value= <?php echo ($_SESSION['uid']); ?>>
        <!--     <input type="hidden" name="author" id="author" value= <?php echo ($_SESSION['uname']); ?>> -->
        <input type="hidden" name="nickname" id="nickname" value= <?php echo ($_SESSION['unickname']); ?>>
    </form>

</div>

<div id="dlg-addgzlist">
    <div class="tool_tip">添加记录后会在列表中出现！！</div>
    <a href="#" id="addok" class="easyui-linkbutton" data-options="iconCls:'icon-ok'"
       onclick="add_gzlist()">确认</a>
    <a href="#" class="easyui-linkbutton"
       data-options="iconCls:'icon-cancel'"
       onclick="javascript:$('#add_gzlist').dialog('close')">取消</a>
</div>
<!-- 编辑窗口 -->

<div id="gz_edit" class="easyui-dialog" style="width:870px; height: 331px; padding: 0px; overflow: hidden;" title="  编辑管子列表" data-options="iconCls:'icon-standard-folder-page',buttons:'#dlg-addgzlist',closed:true,resizable:false,modal:true,closable:true">
    <form id="gz_edit_form"  enctype="multipart/form-data" method="post" >
    <input type="hidden" name="id" id="idsgz"/>
        <table class="add_table">
            <tr>
                <th>分类</th>
                <td>
                    <div class="row_container" style="background: #FFFEE6;">
                        <div class="inline">

                            <select id="gz_fl_add" class="easyui-combobox" name="fl" style="width:80px;" data-options="editable:false,panelHeight:'auto'">   
                <option value="" selected="selected"> .</option>   
                <option value="军车">军车</option>   
                <option value="民车">民车</option>   
                <option value="其他">其他</option>   
            </select> 


                        </div>

                    </div>
                </td>
            </tr>
             <tr>
                <th>标题</th>
                <td style="background-color:rgba(204, 204, 204, 0.4);">
                    <div class="row_container">
                        <div class="inline">
                            <input id="add_gz_title" name="title" class="easyui-textbox" data-options="iconCls:'',editable:true,required:true"   style="width:650px" />
                        </div>
                       

                    </div>

                </td>
            </tr>
            <tr>
                <th>车型(军车)</th>
                <td style="background-color:rgba(204, 204, 204, 0.4);">
                    <div class="row_container">
                        <div class="inline">
                            <input id="cx_gz" name="cx" class="easyui-textbox" data-options="iconCls:'',editable:true,required:false"   style="width:300px" />
                        </div>
                       

                    </div>

                </td>
            </tr>
             <tr>
                <th>驾驶室</th>
                <td style="background-color:rgba(204, 204, 204, 0.4);">
                    <div class="row_container">
                        <div class="inline">
                            <input id="gz_add_pt" class="easyui-combobox" name="pt"   
    data-options="valueField:'text',textField:'text',url:'/solve/index.php/Home/Gz/ptlist',editable:false,panelHeight:'auto'" style="width:100px;"/> 
                        </div>
                       

                    </div>

                </td>
            </tr>
             <tr>
                <th>车类</th>
                <td style="background-color:rgba(204, 204, 204, 0.4);">
                    <div class="row_container">
                        <div class="inline">
                            <select id="add_gz_cl" class="easyui-combobox" name="cxfl" style="width:50px;" data-options="editable:false,panelHeight:'auto'">   
                <option value="" selected="selected"> .</option>   
                <option value="1">1</option>   
                <option value="2">2</option>   
                <option value="3">3</option>
                <option value="4">4</option>
                <option value="5">5</option>   
            </select>  
            <span class="tip">1:载货车，2：越野车，3：自卸车，4：牵引车，5：专用车</span>
                        </div>
                       

                    </div>

                </td>
            </tr>
  
            
            <tr>
                <th>备注</th>
                <td>
                    <div class="row_container">

                        <textarea  name="bz" class="easyui-textbox" id="content" style="width: 100%; height: 50px;"  data-options="required:false,multiline:true,prompt:''"></textarea>



                    </div>
                </td>
            </tr>

        </table>

        <input type="hidden" name="userid" id="userid" value= <?php echo ($_SESSION['uid']); ?>>
        <!--     <input type="hidden" name="author" id="author" value= <?php echo ($_SESSION['uname']); ?>> -->
        <input type="hidden" name="nickname" id="nickname" value= <?php echo ($_SESSION['unickname']); ?>>
    </form>

</div>

<div id="dlg-addgzlist">
    <div class="tool_tip">添加记录后会在列表中出现！！</div>
    <a href="#" id="addok" class="easyui-linkbutton" data-options="iconCls:'icon-ok'"
       onclick="gz_edit()">确认</a>
    <a href="#" class="easyui-linkbutton"
       data-options="iconCls:'icon-cancel'"
       onclick="javascript:$('#gz_edit').dialog('close')">取消</a>
</div>


<!-- 增加附件窗口 -->

<div id="gz_add_fj" class="easyui-dialog" style="width:870px; height: 114px; padding: 0px; overflow: hidden;" title="添加管子文件" data-options="iconCls:'icon-standard-folder-page',buttons:'#dlg-addgzlist',closed:true,resizable:false,modal:true,closable:true">
    <form id="gz_add_fj_form"  enctype="multipart/form-data" method="post" >
        <table class="add_table">
            
            <tr>
                <th>上传文件</th>
                <td>
                    <div class="row_container" style="background: #FFFEE6;">
                        <div class="inline" id="gzlist_uploadfile">

                            <input   name="url[]" id="add_gz_file" style="width:650px;"  class="easyui-filebox" data-options="buttonText:'上传文件',buttonIcon:'icon-standard-application-edit',accept:'application/*,image/*',multiple:'true'">
                            <input type="hidden" name="id" id="id" class="easyui-textbox" />

                        </div>

                    </div>
                </td>
            </tr>
            
            
        </table>


    </form>

</div>

<div id="dlg-addgzlist">
    <div class="tool_tip">添加记录后会在列表中出现！！</div>
    <a href="#" id="addok" class="easyui-linkbutton" data-options="iconCls:'icon-ok'"
       onclick="gz_add_fj()">确认</a>
    <a href="#" class="easyui-linkbutton"
       data-options="iconCls:'icon-cancel'"
       onclick="javascript:$('#gz_add_fj').dialog('close')">取消</a>
</div>

<script type="text/javascript">
  


    // $('#add_gz_file').filebox({
    // onChange: function(newValue,oldValue){

    //     var filelist = newValue.split(",");// 

    //     for(var i=0;i<filelist.length;i++){
    //      // console.log(filelist[i]);
    //      var input='<input name="url[]" class="easyui-textbox" type="file" style="width:300px" value="'+filelist[i]+'">';
    //      $('#gzlist_uploadfile').append(input);

    //     }
      
        
    // }
    
// });
</script>
<!--  -->
<script type="text/javascript">
	$('#gz-dg').datagrid({
	url : '/solve/index.php/Home/Gz/read',
	toolbar : '#tool-gz',
	pagination : true,
	fit : true,
	width : function() {
		return document.body.clientWidth * 0.9
	},
	nowrap : true,//
	collapsible : true,
	fitColumns : false,
	autoRowHeight : true,
	striped : true,//交替行
	singleSelect : true,//只允许选择一行
	rownumbers : true,
	border : false,
	sortName : 'id',
	sortOrder : 'desc',//倒序排列
	remoteSort : false,
	pageSize : 50,
	method : "post",
	pageList : [ 20, 40, 50, 100, 200,500 ],
	columns : [ [
			{
				field : 'id',
				checkbox : true
			},{
				field : 'title',
				title : '标题',
				width : 400,
				align : 'left'
				
			},{
				field : 'fl',
				title : '分类',
				width : 60,
				align : 'center'
				
			},{
				field : 'cx',
				title : '车型(军)',
				width : 100,
				align : 'left'
				
			},{
				field : 'pt',
				title : '平台',
				width : 100,
				align : 'left'
				
			},{
				field : 'cxfl',
				title : '车类',
				width : 50,
				align : 'left'
				
			},{
				field : 'nickname',
				title : '编制',
				width : 100,
				align : 'left'
				
			},{
				field : 'bz',
				title : '备注',
				width : 150,
				align : 'left'
				
			},{
				field : 'row',
				hidden : 'true',
				align : 'left'
				
			}





	] ],
	  onDblClickRow: function (rowIndex, rowData) { 
	
	  	// if(rowData){
	  	// 		canshu(rowData);
	  	// }else{
	  	
	  	// }
	  },
	     onSelect:function(index,row){
	     	// var datass=[];
	     	// $('#show_url').empty();
	     	// var urls=row.url;
	     	// var urlArr=urls.split(",");// 
	     	// for(var i=0;i<urlArr.length;i++){
	     	// 	var filename = urlArr[i].replace("/upload/Gz/","");
	     	// 	var filename = filename.replace(/\d*-\d*-\d*\//,"");
	     	// 	var item={'id':i,'filename':'filename',url:urlArr[i]};
	     	// 	datass.push(item);
	     	// 	// var img='<img src="/solve/public/'+urlArr[i]+'" alt="" />';
	     	// 	// var file='<span  class="gzfile"><a href="/solve/Public'+urlArr[i]+'" target="_blank"><img src="/solve/Public/images/file.png" alt="" width="60px"/></a><span >'+filename+'</span>';
	     	// 	// $('#show_url').append(file);
	     	// }
	     	
$('#gz-dg-fj').datagrid('load',{

			 id:row.id

 });
  //   	$('#update_form').form('load',row);
  //   	if(row.over==1){
  //   		$('#over').combobox('setValue', 1);
  //   	}else{
  //   		$('#over').combobox('setValue', 0);


  //   	}
		// if(row.handletime==null){
		// 	date=new Date(new Date()).Format("yyyy-MM-dd");
		// 	$('#handletime').datebox('setValue', date);
		// }

    },
    rowStyler: function(index,row){
		// if (row.over==1){
		// 	return 'background-color:rgba(76, 147, 243, 0.46);color:#fff;';
		// }
	}
});

	$('#gz-dg-fj').datagrid({
	url : '/solve/index.php/Home/Gz/readfj',
 toolbar :'#tool-gz-fj',
	pagination : true,
	fit : true,
	width : function() {
		return document.body.clientWidth * 0.9
	},
	nowrap : true,//
	collapsible : true,
	fitColumns : true,
	autoRowHeight : true,
	striped : true,//交替行
	singleSelect : true,//只允许选择一行
	rownumbers : true,
	border : false,
	sortName : 'id',
	sortOrder : 'asc',//倒序排列
	remoteSort : false,
	pageSize : 50,
	method : "post",
	pageList : [ 20, 40, 50, 100, 200,500 ],
	columns : [ [
			{
				field : 'id',
				checkbox : true
			},{
				width : 60,
				field : 'filename',
				title : '文件名'
				
			}
			,{
				width : 60,
				field : 'url',
				title : 'url'
				
			}




	] ],
	onDblClickRow: function (rowIndex, rowData) { 
	},
	onSelect:function(index,row){






    }
});
      $('#gz_fl_add').combobox({
    onChange: function(newValue,oldValue){
        // $('#add_gzlist_form').form('clear');
        // console.log(newValue+"+"+oldValue);
     

        //影藏显示
        if(newValue=='军车'){
            // $("#jun_gz").show();
            // $("#min_gz").hide(); 

            $('#add_gz_title').textbox('enable');
            $('#cx_gz').textbox('enable');
            
            $('#gz_add_pt').combobox('disable'); 
            $('#add_gz_cl').combobox('disable'); 
           
        }
        if(newValue=='民车'){
            $('#add_gz_title').textbox('enable');
            $('#cx_gz').textbox('disable');
            $('#gz_add_pt').combobox('enable'); 
            $('#add_gz_cl').combobox('enable'); 
        }
        if(newValue=='' || newValue=='其他'){
	        $('#add_gz_title').textbox('enable');
	        $('#cx_gz').textbox('enable');
            $('#gz_add_pt').combobox('enable'); 
            $('#add_gz_cl').combobox('enable'); 

        }
        
    }
});
//添加
        function add_gzlist(){
        $('#add_gzlist_form').form('submit', {

            url : '/solve/index.php/Home/Gz/add',

            success : function(data) {
                var data = eval('(' + data + ')');
                $('#add_gzlist').dialog('close');
                $("#gz-dg").datagrid("reload");
                $.messager.alert('添加管子列表', data.data, 'info');
            }
        });
}
// 增加管子附件
function gz_add_fj(){
	var row = $('#gz-dg').datagrid("getSelected");
	
	$('#id').textbox('setValue',row.id);
	$('#gz_add_fj_form').form('submit', {

            url : '/solve/index.php/Home/Gz/addfj',

            success : function(data) {
                var data = eval('(' + data + ')');
                $('#gz_add_fj').dialog('close');
                $("#gz-dg-fj").datagrid("reload");
                $.messager.alert('添加管子附件', data.data, 'info');
            }
        });

}

	//删除		
	function dele_gz() {
		var row = $('#gz-dg').datagrid("getSelected");
		var group_id="<?php echo ($_SESSION['group_id']); ?>".split(",");
		
		

			if (row) {
				$.messager.confirm('确认', '您确定要删除此管子列表吗?', function(r) {
					if (r) {
						$.post('/solve/index.php/Home/Gz/del', {
							id : row.id
						}, function(data) {
							if (data) {
								$.messager.alert('删除管子列表', data, 'info');
								$("#gz-dg").datagrid("reload");
								$("#gz-dg-fj").datagrid("reload");
							} else {
								$.messager.show({ // show error message  
									title : '错误',
									msg : result.errorMsg
								});

							}
						}, 'text');
					}
				});
			} else {
				$.messager.alert("请选择", "请选择要删除的管子列表！", "info");
			}

	}

	function delall_gz_fj(){
		var row = $('#gz-dg').datagrid("getSelected");
		var group_id="<?php echo ($_SESSION['group_id']); ?>".split(",");
		
		

			if (row) {
				$.messager.confirm('确认', '您确定要删除此管子列表吗?', function(r) {
					if (r) {
						$.post('/solve/index.php/Home/Gz/delallfj', {
							id : row.id
						}, function(data) {
							if (data) {
								$.messager.alert('删除管子列表', data, 'info');
								$("#gz-dg").datagrid("reload");
								$("#gz-dg-fj").datagrid("reload");
							} else {
								$.messager.show({ // show error message  
									title : '错误',
									msg : result.errorMsg
								});

							}
						}, 'text');
					}
				});
			} else {
				$.messager.alert("请选择", "请选择要删除的管子列表！", "info");
			}

	
	}
// 编辑
function show_gzedit(){
	var row = $('#gz-dg').datagrid("getSelected");
	if (row) {
		$('#gz_edit').window('open'); // open a window 
		$("#gz_edit_form").form("load", row);
			} else {

			$.messager.alert("无法编辑", "请选择要添加附件的管子列表！", "info");
		}
}

function gz_edit(){
	var row = $('#gz-dg').datagrid("getSelected");
	

	$("#idsgz").val(row.id);

		$('#gz_edit_form').form('submit', {
			type:'POST',
			 url : '/solve/index.php/Home/Gz/edit',
			success : function(data) {
				var data = eval('(' + data + ')');
				$('#gz_edit').dialog('close')
				$("#gz-dg").datagrid("reload");
				$.messager.alert('编辑质量信息', data.data, 'info');
				// 

			}
		});
}

// 删除一条附件
function dele_gz_fj(){
	var row = $('#gz-dg').datagrid("getSelected");
	var rowfj = $('#gz-dg-fj').datagrid("getSelected");
		var group_id="<?php echo ($_SESSION['group_id']); ?>".split(",");
		
		

			if (row) {
				$.messager.confirm('确认', '您确定要删除此管子附件文件吗?', function(r) {
					if (r) {
						$.post('/solve/index.php/Home/Gz/delfj', {
							id : row.id,url:rowfj.url
						}, function(data) {
							if (data) {
								$.messager.alert('删除管子管子附件', data, 'info');
								$("#gz-dg-fj").datagrid("reload");
						
							} else {
								$.messager.show({ // show error message  
									title : '错误',
									msg : result.errorMsg
								});

							}
						}, 'text');
					}
				});
			} else {
				$.messager.alert("请选择", "请选择要删除的管子附件文件！", "info");
			}

	
}

</script>